package com.xiaochong.tir.trades.rabbit;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * Created by admin on 2018/6/16.
 */
@Configuration
@Component
public class Hitbtc2QueenConfig {
    @Bean
    public DirectExchange Hitbtc2NodeAPIExchange() {
        return new DirectExchange(ExchangeQueue.Exchange.EX_NODE_API_MQ, true, false);
    }

    @Bean
    public Queue queueTradesHitbtc2BtcAction(){
        return new Queue(Hitbtc2MqQueue.QUEUE_TRADES_HITBTC2_BTC, true);
    }
    @Bean
    public Binding bindingTradesHitbtc2BtcAction(){
        return BindingBuilder.bind(queueTradesHitbtc2BtcAction()).to(Hitbtc2NodeAPIExchange()).with(Hitbtc2MqQueue.QUEUE_TRADES_HITBTC2_BTC);
    }
    @Bean
    public Queue queueTradesHitbtc2UsdtAction(){
        return new Queue(Hitbtc2MqQueue.QUEUE_TRADES_HITBTC2_USDT, true);
    }
    @Bean
    public Binding bindingTradesHitbtc2UsdtAction(){
        return BindingBuilder.bind(queueTradesHitbtc2UsdtAction()).to(Hitbtc2NodeAPIExchange()).with(Hitbtc2MqQueue.QUEUE_TRADES_HITBTC2_USDT);
    }

    @Bean
    public Queue queueTradesHitbtc2EthAction(){
        return new Queue(Hitbtc2MqQueue.QUEUE_TRADES_HITBTC2_ETH, true);
    }
    @Bean
    public Binding bindingTradesHitbtc2EthAction(){
        return BindingBuilder.bind(queueTradesHitbtc2EthAction()).to(Hitbtc2NodeAPIExchange()).with(Hitbtc2MqQueue.QUEUE_TRADES_HITBTC2_ETH);
    }

    @Bean
    public Queue queueTradesHitbtc2UsdAction(){
        return new Queue(Hitbtc2MqQueue.QUEUE_TRADES_HITBTC2_USD, true);
    }
    @Bean
    public Binding bindingTradesHitbtc2UsdAction(){
        return BindingBuilder.bind(queueTradesHitbtc2UsdAction()).to(Hitbtc2NodeAPIExchange()).with(Hitbtc2MqQueue.QUEUE_TRADES_HITBTC2_USD);
    }
}
